package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.back.domain.dto.CheckTemplateDto
import com.ruoyi.back.domain.dto.TemplateRecommendSearchDto
import com.ruoyi.back.domain.vo.CheckStatusSumVo
import com.ruoyi.back.domain.vo.TemplateRecommendListVo
import com.ruoyi.back.service.TemplateRecommendService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("system/templateRecommend")
@Api(tags = ["模板推荐 视频&图片"])
class TemplateRecommendController {

    @Autowired
    private lateinit var templateRecommendService: TemplateRecommendService


    @ApiOperation("获取审核状态统计")
    @GetMapping("checkStatusSum/{type}")
    fun checkStatusSum(@PathVariable type: Int): Data<CheckStatusSumVo> = templateRecommendService.checkStatusSum(type)

    @ApiOperation("模板推荐分页")
    @GetMapping("page")
    fun templateRecommendPage(templateRecommendSearchDto: TemplateRecommendSearchDto): PageData<TemplateRecommendListVo> =
        templateRecommendService.templateRecommendPage(templateRecommendSearchDto)

    @ApiOperation("审核模板推荐")
    @PostMapping("checkTemplateRecommend")
    fun checkTemplateRecommend(@RequestBody checkTemplateDto: CheckTemplateDto): Data<Boolean> =
        templateRecommendService.checkTemplateRecommend(checkTemplateDto)


    @ApiOperation("删除模板推荐")
    @GetMapping("remove/{ids}")
    fun removeTemplateRecommend(@PathVariable ids: String): Data<Boolean> =
        templateRecommendService.removeTemplateRecommend(ids)

    @ApiOperation("下架模板推荐")
    @GetMapping("offlineTemplateRecommend/{id}")
    fun offlineTemplateRecommend(@PathVariable id: Long): Data<Boolean> =
        templateRecommendService.offlineTemplateRecommend(id)
}